import http from '@/utils/axios'

// 获取商品统计数据
export const getProductData = async () => {
    return await http.get('/page2-data')
}
//R
export const getProducts = async () => {
        return  await http.get('/products')
}

// C
export const addProduct = async (productData) => {
    return await http.post('/products', productData)
}

// U
export const updateProduct = async (productId, productData) => {

    return await http.put(`/products/${productId}`, productData)

}
// D
export const deleteProduct = async (productId) => {

    return  await http.delete(`/products/${productId}`)
}

// 获取商品分类统计数据
export const getCategoryData = async () => {
    return await http.get('/data')
}
